﻿@model List<SnongPhoneShop.Models.PhieuDatHang>
@{
    ViewBag.Title = "Danh sách đơn đặt hàng";
    Layout = "~/Views/Shared/_LayoutAccMetroUI.cshtml";
    ViewBag.CurrPage = "Giỏ hàng";
}

@section selected_link{
    <style>
        .list-orders {
            background:#808080;
        }
    </style>    
}
<table border="1" class="cart-table fixed-header">
    <tr>
        <th class="order-id-product" rowspan="2">Mã đơn hàng</th>
        <th class="order-name-product" colspan="2">Sản phẩm</th>
        <th class="order-price-product" rowspan="2">Thành tiền (VNĐ)</th>
        <th class="order-status-product" rowspan="2">Trạng thái</th>
    </tr>
    <tr>
        <th class="order-phone-product">Điện thoại</th>
        <th class="order-access-product">Phụ kiện</th>
    </tr>
</table>
<div class="hidden-scrollbar">
    <div class="order-body-table scroll-enable">
        <table border="1" class="cart-table fixed-header">
            @foreach (var Item in Model) {
                long total_price = 0;
                <tr>
                    <td class="order-id-product">@Item.MaPhieuDatHang</td>
                    <td class="order-phone-product">
                        @foreach (var i in Item.CT_PhieuDatHang.Where(m => m.SanPham.DanhMucSanPham.MaLoaiDanhMuc == 1).ToList()) {
                            total_price += i.SoLuong * i.SanPham.DonGia;
                            <div>@i.SanPham.TenSanPham x @i.SoLuong</div> 
                        }
                    </td>
                    <td class="order-access-product">
                        @foreach (var i in Item.CT_PhieuDatHang.Where(m => m.SanPham.DanhMucSanPham.MaLoaiDanhMuc == 2).ToList()) {
                            total_price += i.SoLuong * i.SanPham.DonGia;
                            <div>@i.SanPham.TenSanPham x @i.SoLuong</div> 
                        }
                    </td>
                    <td class="order-price-product">@total_price.ToString("n0")</td>
                    <td class="order-status-product">@Item.TrangThaiPhieuDatHang.TenTrangThai</td>
                </tr>
            }
        </table>
    </div>
</div>